<?php
namespace  Teachers\Controller;
use Think\Controller;
class ApplyController extends CommonController
{
  /**
     * 报名管理
     */
    public function apply() {
        $SchoolApply = M('SchoolApply');
        $school_id=$this->showschoolID();
        $map['school_id'] = $school_id;
        $count = $SchoolApply->where($map)->count(); // 查询满足要求的总记录数
        $Page = new \Superadmins\Controller\PageController($count, 6); // 实例化分页类 传入总记录数和每页显示的记录数(25)
        $show = $Page->show(); // 分页显示输出
        $School_data = $SchoolApply->where($map)->limit($Page->firstRow . ',' . $Page->listRows)->select();
        $this->assign('apply', $School_data);
        $this->assign('school_id', $school_id);
        $this->assign('page', $show); // 赋值分页输出	
        $this->display();
    }
    
    Public function getOneApply(){
    	$data=I("post.");
    	if($data['apply_id']){
    		$map['apply_id']=$data['apply_id'];
    		$SchoolApply = M('SchoolApply');
    		$data=$SchoolApply->where($map)->find();
    	}
    	$this->ajaxReturn($data);
    }
    
	Public function deleteApply(){
    	$data=I("post.");
    	if($data['apply_id']){
    		$map['apply_id']=$data['apply_id'];
    		$SchoolApply = M('SchoolApply');
    		$flag=$SchoolApply->where($map)->delete();
    	}
    }

}